1. Field of the Invention
This invention relates in general to a computer operating systems, and more particularly to a method, apparatus and program storage device for providing a no context switch attribute that allows a user mode thread to become a near interrupt disabled priority.
2. Description of Related Art
In computing, an operating system (OS) is the system software responsible for the direct control and management of hardware and basic system operations. Additionally, it provides a foundation upon which to run application software such as word processing programs and web browsers. Many modern operating systems support multitasking by which multiple threads share common processing resources such as a processor. A thread in computer science is short for a thread of execution or a sequence of instructions. Threads are basically processes that run in the same memory context. Multiple threads can be executed in parallel on many computer systems. This multithreading generally occurs by time slicing (where a single processor switches between different threads) or by multiprocessing (where threads are executed on separate processors). Threads are similar to processes, but differ in the way that they share resources.
In the case of a computer with a single processor, only one thread is said to be running at any point in time, meaning that the processor is actively executing instructions for that thread. Multitasking solves the problem by scheduling which thread may be running at any given time, and when another waiting thread gets a turn. The act of reassigning a processor from one thread to another one is called a context switch. Each time a process is removed from access to the processor, sufficient information on its current operating state must be stored such that when it is again scheduled to run on the processor it can resume its operation from an identical position. This operational state data is known as its context and the act of removing the process's thread of execution from the processor (and replacing it with another) is known as a process switch or context switch. When context switches occur frequently enough the illusion of parallelism is achieved. Even on computers with more than one processor, multitasking allows many more tasks to be run than there are processors.
An operating system manages the system and runs third-party application software for that system. Thus, the common understanding is that an operating system includes not only the low-level “kernel” that interacts directly with the hardware, but also libraries required by applications as well as basic programs to manipulate files and configure the system. The operating system kernel allows programmers to manipulate threads via the system call interface.
Operating systems may adopt one of many different scheduling strategies, which generally fall into one of the following categories. In multiprogramming systems, the running task keeps running until it performs an operation that requires waiting for an external event (e.g. reading from a tape). Multiprogramming systems are designed to maximize processor usage. In time-sharing systems, the running task is required to relinquish the processor, either voluntarily or by an external event such as a hardware interrupt. Time sharing systems are designed to allow several programs to execute apparently simultaneously. In real-time systems, some waiting tasks are guaranteed to be given the processor when an external event occurs.
The architecture of an operating system includes two main layers: a user mode and a kernel mode. Programs and subsystems in user mode are limited in terms of what system resources they have access to, while the kernel mode has unrestricted access to the system memory and external devices. The user mode is a nonprivileged state where the executing code is forbidden by the hardware from performing certain operations (such as writing to memory not assigned to it) that could destabilize the system or constitute a security hole.
Today's operating systems, e.g., Linux, Windows, Unix, support programs running in user mode and programs running in kernel mode. For example, all of the Windows 2000 subsystems and applications run in user mode, and each subsystem and application runs in its own protected address space. Thus, a process is always running in either user mode or kernel mode. The main body of a user program is executed in user mode and system calls are executed in kernel mode. The kernel mode includes code for providing a protected memory mode with full privileges. The user mode includes privileges to access its own memory area. User applications and environmental subsystems execute in this mode. In addition, user mode is a mechanism in certain operating systems, e.g., Linux, Windows, etc., that lets the user install a separate instance of the operating system within the larger installation. User mode thus lets the user create a virtual machine within the computer, thereby providing he ability to create test situations, for example, without running the risk of creating problems within the main system.
There are several advantages to operating in user mode. Operating in user mode allows an engineer to debug code without having a separate test machine, to setup different versions of the software kernel (main memory and processing area of the software), and to train new users. User mode can also isolate the processes that are running inside it so that a virus or other malicious code may be prevented from infecting the larger machine, thereby saving hours of unplanned reinstallation and rebuilding. User mode is also helpful for testing new network configurations and creating disaster recovery drills because it insulates the main installation from unintentional or intentional damage.
The Open Source Initiative (OSI) was formed in February 1998. OSI hoped that the usage of the label “open source” would eliminate ambiguity, particularly for individuals who perceive “free software” as anti-commercial. Thus, the OSI sought to bring a higher profile to the practical benefits of freely available source code, and wanted to bring major software businesses and other high-tech industries into open source. Open source software refers to computer software and the availability of its source code as open source under an open source license to study, change, and improve its design. Thus, open source refers to software in which the source code is freely available for others to view, amend, and adapt. Typically it's created and maintained by a team of developers that crosses institutional and national boundaries. As such, open source software can't be appropriated by one large proprietary vendor.
Linux is one of the most prominent examples of free software and of open-source development: unlike proprietary operating systems such as Windows and Mac OS, all of its underlying source code is available to the public and anyone can freely use, modify, and redistribute it. In the narrowest sense, the term Linux refers to the Linux kernel, but it is commonly used to describe entire Unix-like operating systems (also known as GNU/Linux) that are based on the Linux kernel combined with libraries and tools from the GNU project and other sources. Most broadly, a Linux distribution bundles large quantities of application software with the core system, and provides more user-friendly installation and upgrades. But Linux (or more accurately GNU/Linux) is just the tip of the iceberg. Today there is a wide range of open source software available, and new projects are being started all the time.
With the popularity of open source kernel (e.g. Linux), more and more controller programs are moving to user mode. However, a controller program constantly requires access to hardware in real-time fashion and therefore needs to allow a user mode thread to run in a near interrupt disabled priority. Some real-time operating systems offer special real time priority. However, to provide flexibility, they still might share the priority with other threads at the same real-time priority.
It can be seen then that there is a need for a method, apparatus and program storage device for providing a no context switch attribute that allows a user mode thread to become a near interrupt disabled priority.